#include "AmbientEffects.h"

void AmbientEffects::rainbow(CRGB* leds, uint16_t width, uint16_t height, uint8_t& hue) {
    hue += 1;
    for (uint8_t x = 0; x < width; x++) {
        uint8_t columnHue = hue + x * 7;
        for (uint8_t y = 0; y < height; y++) {
            uint8_t pixelHue = columnHue + y * 3;
            leds[x * height + y] = CHSV(pixelHue, 255, 255);
        }
    }
}

void AmbientEffects::purple(CRGB* leds, uint16_t numLeds, float& progress, unsigned long& lastUpdate) {
    if (millis() - lastUpdate > purpleUpdateInterval) {
        lastUpdate = millis();
        progress += colorCycleSpeed;
        if (progress > 1.0f) progress = 0.0f;
        
        float sineValue = sin(progress * PI);
        float normalized = pow(sineValue, 2); 
        
        uint8_t red = 100 + normalized * 155;
        uint8_t blue = 100 + normalized * 50;
        
        fill_solid(leds, numLeds, CRGB(red, 0, blue));
    }
}